home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / tests / sparse.tst < prev    next >
Text File  |  1999-09-16  |  33KB  |  771 lines

  1.  
  2. mode(5)
  3. lines(0)
  4. ij=[1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6];
  5. v=[1;2;3;4;5;6;7;8;9];
  6. ij1=[1 6;1 2;6 5];
  7. v1=[-1;-1;-1];
  8. vc=v+%i*(21:29)';
  9. v1c=v1+%i*[0;0.3;-1.2];
  10. zer=sparse([],[],[6,6]);
  11. //
  12. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  13. b=sparse([1 6;1 2;6 5],[-1;-1;-1],[6 6]);
  14. ma=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9),[6 6]);
  15. mb=sparse([1 6;1 2;6 5],-[-1;-1;-1],[6 6]);
  16. ac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[6 6]);
  17. bc=sparse([1 6;1 2;6 5],[-1;-1;-1]+%i*[0;0.3;-1.2],[6 6]);
  18. mac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9)-%i*(21:29),[6 6]);
  19. mbc=sparse([1 6;1 2;6 5],[1;1;1]+%i*[0;-0.3;1.2],[6 6]);
  20. //
  21. if %t then
  22. //-------------------------------------------------------------
  23. //test des primitives sparse, full
  24. //--------------------------------------------------------------
  25. //  -- for real matrix
  26. if or(full(sparse(0.3))<>0.3) then pause,end
  27. v=0*ones(1,3);v(3)=5;v(1)=1;
  28. if or(full(sparse([1 1;1 3],[1 5]))<>v) then pause,end
  29. v=0*ones(1,300);v(300)=5;v(1)=1;
  30. if or(full(sparse([1 1;1 300],[1 5]))<>v) then pause,end
  31. v=0*ones(3,1);v(3)=5;v(1)=1;
  32. if or(full(sparse([1 1;3 1],[1 5]))<>v) then pause,end
  33. v=0*ones(300,1);v(300)=5;v(1)=1;
  34. if or(full(sparse([1 1;300 1],[1 5]))<>v) then pause,end
  35. sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  36. a=[0,0,3,0,2,1;;5,0,0,4,0,0;0,0,0,0,0,0;0,0,7,6,0,0;8,0,0,0,0,0;0,0,0,0,0,9];
  37. if or(full(sp)<>a) then pause,end
  38. sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[8 6]);a(8,6)=0;
  39. if or(full(sp)<>a) then pause,end
  40. if or(full(sparse([],[],[4 10]))<>0*ones(4,10)) then pause,end
  41. v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
  42. a=[0;10;11;12;0;13];
  43. if or(full(v)<>a) then pause,end
  44. v=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
  45. a=[0,10,11,12,0,13];
  46. if or(full(v)<>a) then pause,end
  47. //  -- for complex matrix
  48. sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[6 6]);
  49. a=[0,0,3+%i*23,0,2+%i*22,1+%i*21
  50.    5+%i*25,0,0,4+%i*24,0,0
  51.    0,0,0,0,0,0
  52.    0,0,7+%i*27,6+%i*26,0,0
  53.    8+%i*28,0,0,0,0,0
  54.    0,0,0,0,0,9+%i*29];
  55. if or(full(sp)<>a) then pause,end
  56. sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[8 6]);
  57. a(8,6)=0;
  58. if or(full(sp)<>a) then pause,end
  59. v=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);
  60. a=[0;10-%i*3;11;12+%i*5;0;13+%i*0.5];
  61. if or(full(v)<>a) then pause,end
  62. v=sparse([1 2;1 3;1 4;1 6],[10-3*%i;11;12+5*%i;13+0.5*%i],[1,6]);
  63. a=[0,10-%i*3,11,12+%i*5,0,13+%i*0.5];
  64. if or(full(v)<>a) then pause,end
  65. //-------------------------------------------------------------
  66. //test de la primitives spget
  67. //--------------------------------------------------------------
  68. sp=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  69. [ij,v]=spget(sp);
  70. if or(ij<>[1,3;1,5;1,6;2,1;2,4;4,3;4,4;5,1;6,6])|or(v<>[3;2;1;5;4;7;6;8;9]) then pause,end
  71. zer=sparse([],[],[6,6]);[ij,v]=spget(zer);
  72. if ij<>[]|v<>[] then pause,end
  73. //-----------------------------------------------
  74. // addition and substraction tests
  75. //-----------------------------------------------
  76. // -- real real
  77. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  78. b=sparse([1 6;1 2;6 5],[-1;-1;-1],[6 6]);
  79. v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
  80. vt=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
  81. ma=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9),[6 6]);
  82. mb=sparse([1 6;1 2;6 5],-[-1;-1;-1],[6 6]);
  83. zer=sparse([],[],[6,6]);
  84. ac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],(1:9)+%i*(21:29),[6 6]);
  85. bc=sparse([1 6;1 2;6 5],[-1;-1;-1]+%i*[0;0.3;-1.2],[6 6]);
  86. vc=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);
  87. vct=sparse([1 2;1 3;1 4;1 6],[10-3*%i;11;12+5*%i;13+0.5*%i],[1,6]);
  88. mac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9)-%i*(21:29),[6 6]);
  89. mbc=sparse([1 6;1 2;6 5],[1;1;1]+%i*[0;-0.3;1.2],[6 6]);
  90. if or(full(v+sparse([],[],[6,1]))<>full(v)) then pause,end
  91. if or(full(sparse([],[],[6,1])+v)<>full(v)) then pause,end
  92. if or(full(v+v)<>full(v)+full(v)) then pause,end
  93. if or(full(v-v)<>full(v)-full(v)) then pause,end
  94. if or(full(vt+sparse([],[],[1,6]))<>full(vt)) then pause,end
  95. if or(full(vt+vt)<>full(vt)+full(vt)) then pause,end
  96. if or(full(vt-vt)<>full(vt)-full(vt)) then pause,end
  97. if or(full(zer+zer)<>0*ones(6,6)) then pause,end
  98. if or(full(a+a)<>full(a)+full(a)) then pause,end
  99. if or(full(b+b)<>full(b)+full(b)) then pause,end
  100. if or(full(a+zer)<>full(a)) then pause,end
  101. if or(full(zer+a)<>full(a)) then pause,end
  102. if or(full(b+a)<>full(b)+full(a)) then pause,end
  103. if or(full(a+b)<>full(b)+full(a)) then pause,end
  104. if or(full(a+ma)<>full(a)+full(ma)) then pause,end
  105. if or(full(a-a)<>full(a)-full(a)) then pause,end
  106. if or(full(a-ma)<>full(a)-full(ma)) then pause,end
  107. if or(full(b-mb)<>full(b)-full(mb)) then pause,end
  108. if or(full(a-zer)<>full(a)) then pause,end
  109. if or(full(zer-a)<>-full(a)) then pause,end
  110. if or(full(a-mb)<>full(a)-full(mb)) then pause,end
  111. //  -- real complex
  112. if or(full(sparse([],[],[6,1])+vc)<>full(vc)) then pause,end
  113. if or(full(v+vc)<>full(v)+full(vc)) then pause,end
  114. if or(full(v-vc)<>full(v)-full(vc)) then pause,end
  115. if or(full(vt+vct)<>full(vt)+full(vct)) then pause,end
  116. if or(full(vt-vct)<>full(vt)-full(vct)) then pause,end
  117. if or(full(a+ac)<>full(a)+full(ac)) then pause,end
  118. if or(full(b+bc)<>full(b)+full(bc)) then pause,end
  119. if or(full(a+bc)<>full(a)+full(bc)) then pause,end
  120. if or(full(zer+ac)<>full(zer)+full(ac)) then pause,end
  121. if or(full(b+ac)<>full(b)+full(ac)) then pause,end
  122. if or(full(a-ac)<>full(a)-full(ac)) then pause,end
  123. if or(full(b-bc)<>full(b)-full(bc)) then pause,end
  124. if or(full(a-bc)<>full(a)-full(bc)) then pause,end
  125. if or(full(zer-ac)<>full(zer)-full(ac)) then pause,end
  126. if or(full(b-ac)<>full(b)-full(ac)) then pause,end
  127. // -- complex real
  128. if or(full(vc+v)<>full(vc)+full(v)) then pause,end
  129. if or(full(vc-v)<>full(vc)-full(v)) then pause,end
  130. if or(full(vct+vt)<>full(vct)+full(vt)) then pause,end
  131. if or(full(vct-vt)<>full(vct)-full(vt)) then pause,end
  132. if or(full(ac+a)<>full(ac)+full(a)) then pause,end
  133. if or(full(bc+b)<>full(bc)+full(b)) then pause,end
  134. if or(full(ac+b)<>full(ac)+full(b)) then pause,end
  135. if or(full(ac+zer)<>full(zer)+full(ac)) then pause,end
  136. if or(full(bc+a)<>full(bc)+full(a)) then pause,end
  137. if or(full(ac-a)<>full(ac)-full(a)) then pause,end
  138. if or(full(bc-b)<>full(bc)-full(b)) then pause,end
  139. if or(full(ac-b)<>full(ac)-full(b)) then pause,end
  140. if or(full(ac-zer)<>-full(zer)+full(ac)) then pause,end
  141. if or(full(bc-a)<>full(bc)-full(a)) then pause,end
  142. // -- complex complex
  143. if or(full(vc+vc)<>full(vc)+full(vc)) then pause,end
  144. if or(full(vc-vc)<>full(vc)-full(vc)) then pause,end
  145. if or(full(vct+vct)<>full(vct)+full(vct)) then pause,end
  146. if or(full(vct-vct)<>full(vct)-full(vct)) then pause,end
  147. if or(full(ac+ac)<>full(ac)+full(ac)) then pause,end
  148. if or(full(bc+bc)<>full(bc)+full(bc)) then pause,end
  149. if or(full(ac+bc)<>full(ac)+full(bc)) then pause,end
  150. if or(full(bc+ac)<>full(bc)+full(ac)) then pause,end
  151. if or(full(ac-ac)<>full(zer)) then pause,end
  152. if or(full(bc-bc)<>full(zer)) then pause,end
  153. if or(full(ac-bc)<>full(ac)-full(bc)) then pause,end
  154. if or(full(bc-ac)<>full(bc)-full(ac)) then pause,end
  155. // sparse full and full sparse operation (soft coded apoerations)
  156. if or(full(a+1)<>full(a)+1) then pause,end
  157. if or(full(1+a)<>full(a)+1) then pause,end
  158. if or(full(a+ones(6,6))<>full(a)+ones(6,6)) then pause,end
  159. if or(full(ones(6,6)+a)<>full(a)+ones(6,6)) then pause,end
  160. if or(full(a+2*eye)<>full(a)+2*eye) then pause,end
  161. if or(full(2*eye+a)<>full(a)+2*eye) then pause,end
  162. if or(full(a-1)<>full(a)-1) then pause,end
  163. if or(full(1-a)<>1-full(a)) then pause,end
  164. if or(full(a-ones(6,6))<>full(a)-ones(6,6)) then pause,end
  165. if or(full(ones(6,6)-a)<>ones(6,6)-full(a)) then pause,end
  166. if or(full(a-2*eye)<>full(a)-2*eye) then pause,end
  167. if or(full(2*eye-a)<>2*eye-full(a)) then pause,end
  168. if or(full(ac+1)<>full(ac)+1) then pause,end
  169. if or(full(1+ac)<>full(ac)+1) then pause,end
  170. if or(full(ac+ones(6,6))<>full(ac)+ones(6,6)) then pause,end
  171. if or(full(ones(6,6)+ac)<>full(ac)+ones(6,6)) then pause,end
  172. if or(full(ac+2*eye)<>full(ac)+2*eye) then pause,end
  173. if or(full(2*eye+ac)<>full(ac)+2*eye) then pause,end
  174. if or(full(ac-1)<>full(ac)-1) then pause,end
  175. if or(full(1-ac)<>1-full(ac)) then pause,end
  176. if or(full(ac-ones(6,6))<>full(ac)-ones(6,6)) then pause,end
  177. if or(full(ones(6,6)-ac)<>ones(6,6)-full(ac)) then pause,end
  178. if or(full(ac-2*eye)<>full(ac)-2*eye) then pause,end
  179. if or(full(2*eye-ac)<>2*eye-full(ac)) then pause,end
  180. if or(full(ac+full(bc))<>full(ac)+full(bc)) then pause,end
  181. if or(full(ac-full(bc))<>full(ac)-full(bc)) then pause,end
  182. if or(full(full(ac)+full(bc))<>full(ac)+full(bc)) then pause,end
  183. end
  184. if %t then
  185. //-----------------------------------------------
  186. // multiplication tests
  187. //-----------------------------------------------
  188. // real x real
  189. // sparse scalar , saclar sparse
  190. if or(full(a*2)<>full(a)*2) then pause,end
  191. if or(full(2*a)<>full(a)*2) then pause,end
  192. if  a*[]<>[] then pause,end
  193. if  []*a<>[] then pause,end
  194. c=rand(6,6);
  195. if norm(a*c-full(a)*c) >100*%eps then pause,end
  196. if norm(c*a-c*full(a)) >100*%eps then pause,end
  197. // sparse sparse
  198. if or(full(zer*zer)<>full(zer)) then pause,end
  199. if or(full(a*zer)<>full(zer)) then pause,end
  200. if or(full(zer*a)<>full(zer)) then pause,end
  201. if  norm(full(a*a)-full(a)*full(a),1)>100*%eps then pause,end
  202. if  norm(full(b*b)-full(b)*full(b),1)>100*%eps then pause,end
  203. if  norm(full(a*b)-full(a)*full(b),1)>100*%eps then pause,end
  204. if  norm(full(b*a)-full(b)*full(a),1)>100*%eps then pause,end
  205. // complex x real real x complex
  206. // sparse scalar , scalar sparse
  207. if or(full(ac*2)<>full(ac)*2) then pause,end
  208. if or(full(2*ac)<>full(ac)*2) then pause,end
  209. if norm(full((2+%i)*a)-(2+%i)*full(a),1) >100*%eps then pause,end
  210. if norm(full(a*(2+%i))-(2+%i)*full(a),1) >100*%eps then pause,end
  211. if  ac*[]<>[] then pause,end
  212. if  []*ac<>[] then pause,end
  213. c=rand(6,6);
  214. cc=c+rand(6,6)*%i;
  215. if norm(ac*c-full(ac)*c) >100*%eps then pause,end
  216. if norm(cc*a-cc*full(a)) >100*%eps then pause,end
  217. // sparse sparse
  218. if or(full(ac*zer)<>full(zer)) then pause,end
  219. if or(full(zer*ac)<>full(zer)) then pause,end
  220. if  norm(full(ac*a)-full(ac)*full(a),1)>100*%eps then pause,end
  221. if  norm(full(bc*b)-full(bc)*full(b),1)>100*%eps then pause,end
  222. if  norm(full(a*bc)-full(a)*full(bc),1)>100*%eps then pause,end
  223. if  norm(full(b*ac)-full(b)*full(ac),1)>100*%eps then pause,end
  224. // // complex x complex
  225. if norm(ac*cc-full(ac)*cc) >100*%eps then pause,end
  226. if norm(cc*ac-cc*full(ac)) >100*%eps then pause,end
  227. // sparse sparse
  228. if  norm(full(ac*ac)-full(ac)*full(ac),1)>100*%eps then pause,end
  229. if  norm(full(bc*bc)-full(bc)*full(bc),1)>100*%eps then pause,end
  230. if  norm(full(bc*ac)-full(bc)*full(ac),1)>100*%eps then pause,end
  231. //----------------------------------------------------------
  232. // element wise multiplication tests
  233. //----------------------------------------------------------
  234. if or(full(ac.*2)<>full(ac)*2) then pause,end
  235. if or(full((2).*ac)<>full(ac)*2) then pause,end
  236. if  a.*[]<>[] then pause,end
  237. if  [].*a<>[] then pause,end
  238. c=rand(6,6);
  239. //if norm(a*c-full(a)*c) >100*%eps then pause,end
  240. //if norm(c*a-c*full(a)) >100*%eps then pause,end
  241. // sparse sparse
  242. if or(full(zer.*zer)<>full(zer)) then pause,end
  243. if or(full(a.*zer)<>full(zer)) then pause,end
  244. if or(full(zer.*a)<>full(zer)) then pause,end
  245. if  norm(full(a.*a)-full(a).*full(a),1)>100*%eps then pause,end
  246. if  norm(full(b.*b)-full(b).*full(b),1)>100*%eps then pause,end
  247. if  norm(full(a.*b)-full(a).*full(b),1)>100*%eps then pause,end
  248. if  norm(full(b.*a)-full(b).*full(a),1)>100*%eps then pause,end
  249. // complex x real real x complex
  250. // sparse scalar , scalar sparse
  251. if norm(full((2+%i).*a)-(2+%i).*full(a),1) >100*%eps then pause,end
  252. if norm(full(a.*(2+%i))-(2+%i).*full(a),1) >100*%eps then pause,end
  253. if  ac.*[]<>[] then pause,end
  254. if  [].*ac<>[] then pause,end
  255. c=rand(6,6);
  256. cc=c+rand(6,6)*%i;
  257. if norm(full(ac.*c)-full(ac).*c) >100*%eps then pause,end
  258. if norm(full(cc.*a)-cc.*full(a)) >100*%eps then pause,end
  259. // sparse sparse
  260. if or(full(ac.*zer)<>full(zer)) then pause,end
  261. if or(full(zer.*ac)<>full(zer)) then pause,end
  262. if  norm(full(ac.*a)-full(ac).*full(a),1)>100*%eps then pause,end
  263. if  norm(full(bc.*b)-full(bc).*full(b),1)>100*%eps then pause,end
  264. if  norm(full(a.*bc)-full(a).*full(bc),1)>100*%eps then pause,end
  265. if  norm(full(b.*ac)-full(b).*full(ac),1)>100*%eps then pause,end
  266. // // complex x complex
  267. if norm(ac.*cc-full(ac).*cc) >100*%eps then pause,end
  268. if norm(cc.*ac-cc.*full(ac)) >100*%eps then pause,end
  269. // sparse sparse
  270. if  norm(full(ac.*ac)-full(ac).*full(ac),1)>100*%eps then pause,end
  271. if  norm(full(bc.*bc)-full(bc).*full(bc),1)>100*%eps then pause,end
  272. if  norm(full(bc.*ac)-full(bc).*full(ac),1)>100*%eps then pause,end
  273. // ----------------------------------------------------------
  274. // test de la transposition
  275. //-----------------------------------------------------------
  276. if or(full(a')<>full(a)') then pause,end
  277. if or(full(ac')<>full(ac)') then pause,end
  278. if or(full(zer')<>full(zer)' ) then pause,end
  279. v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
  280. if or(full(v')<>full(v)') then pause,end
  281. if or(full((v')')<>full(v)) then pause,end
  282. vc=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);
  283. if or(full(vc')<>full(vc)') then pause,end
  284. if or(full((vc')')<>full(vc)) then pause,end
  285. // ----------------------------------------------------------
  286. // test des concatenation
  287. //-----------------------------------------------------------
  288. if or(full([a])<>full(a)) then pause,end
  289. if or(full([a b])<>[full(a) full(b)]) then pause,end
  290. if or(full([a;b])<>[full(a);full(b)]) then pause,end
  291. if or(full([a []])<>full(a)) then pause,end
  292. if or(full([a;[]])<>full(a)) then pause,end
  293. if or(full([a zer])<>[full(a) full(zer)]) then pause,end
  294. if or(full([zer;b])<>[full(zer);full(b)]) then pause,end
  295. if or(full([ac])<>full(ac)) then pause,end
  296. if or(full([ac b])<>[full(ac) full(b)]) then pause,end
  297. if or(full([ac;b])<>[full(ac);full(b)]) then pause,end
  298. if or(full([ac []])<>full(ac)) then pause,end
  299. if or(full([ac;[]])<>full(ac)) then pause,end
  300. if or(full([a bc])<>[full(a) full(bc)]) then pause,end
  301. if or(full([a;bc])<>[full(a);full(bc)]) then pause,end
  302. if or(full([ac bc])<>[full(ac) full(bc)]) then pause,end
  303. if or(full([ac;bc])<>[full(ac);full(bc)]) then pause,end
  304. // ----------------------------------------------------------
  305. // test des extractions
  306. //-----------------------------------------------------------
  307. af=full(a);
  308. if or(full(a(1,3))<>af(1,3)) then pause,end
  309. if or(full(a(1,4))<>af(1,4)) then pause,end
  310. if or(full(a(1,:))<>af(1,:)) then pause,end
  311. v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);vf=full(v);
  312. if or(full(v(:))<>vf(:)) then pause,end
  313. if or(full(v(3:4))<>vf(3:4)) then pause,end
  314. if or(full(v([1 5]))<>vf([1 5])) then pause,end
  315. if or(full(v([4 3]))<>vf([4 3])) then pause,end
  316. if or(full(v([4 4]))<>vf([4 4])) then pause,end
  317. if or(full(v([1 1]))<>vf([1 1])) then pause,end
  318. v=v';vf=vf';
  319. if or(full(v(:))<>vf(:)) then pause,end
  320. if or(full(v(3:4))<>vf(3:4)) then pause,end
  321. if or(full(v([1 5]))<>vf([1 5])) then pause,end
  322. if or(full(v([4 3]))<>vf([4 3])) then pause,end
  323. if or(full(v([4 4]))<>vf([4 4])) then pause,end
  324. if or(full(v([1 1]))<>vf([1 1])) then pause,end
  325. acff=full(ac);
  326. if or(full(ac(1,3))<>acff(1,3)) then pause,end
  327. if or(full(ac(1,4))<>acff(1,4)) then pause,end
  328. if or(full(ac(1,:))<>acff(1,:)) then pause,end
  329. vc=sparse([2 1;3 1;4 1;6 1],[10-3*%i;11;12+5*%i;13+0.5*%i],[6,1]);vcf=full(vc);
  330. if or(full(vc(:))<>vcf(:)) then pause,end
  331. if or(full(vc(3:4))<>vcf(3:4)) then pause,end
  332. if or(full(vc([1 5]))<>vcf([1 5])) then pause,end
  333. if or(full(vc([4 3]))<>vcf([4 3])) then pause,end
  334. if or(full(vc([4 4]))<>vcf([4 4])) then pause,end
  335. if or(full(vc([1 1]))<>vcf([1 1])) then pause,end
  336. vc=vc';vcf=vcf';
  337. if or(full(vc(:))<>vcf(:)) then pause,end
  338. if or(full(vc(3:4))<>vcf(3:4)) then pause,end
  339. if or(full(vc([1 5]))<>vcf([1 5])) then pause,end
  340. if or(full(vc([4 3]))<>vcf([4 3])) then pause,end
  341. if or(full(vc([4 4]))<>vcf([4 4])) then pause,end
  342. if or(full(vc([1 1]))<>vcf([1 1])) then pause,end
  343. // ----------------------------------------------------------
  344. // test des insertions
  345. //-----------------------------------------------------------
  346. end
  347. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  348. vt=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
  349. // full line insertion
  350. //----------------------
  351. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  352. if or(full(a1)<>A) then pause,end
  353. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  354. if or(full(a1)<>A) then pause,end
  355. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  356. if or(full(a1)<>A) then pause,end
  357. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  358. if or(full(a1)<>A) then pause,end
  359. a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
  360. if or(full(a1)<>A) then pause,end
  361. a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
  362. if or(full(a1)<>A) then pause,end
  363. a1=a;a1([1 3],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([1 3],:)=[Vt;2*Vt];
  364. if or(full(a1)<>A) then pause,end
  365. a1=a;a1([3 1],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([3 1],:)=[Vt;2*Vt];
  366. if or(full(a1)<>A) then pause,end
  367. a1=a;a1([1 3 1],:)=[vt;2*vt;3*vt];A=full(a);Vt=full(vt);A([1 3 1],:)=[Vt;2*Vt;3*Vt];
  368. if or(full(a1)<>A) then pause,end
  369. //  insert zero vector
  370. vt=sparse([],[],[1,6]);
  371. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  372. if or(full(a1)<>A) then pause,end
  373. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  374. if or(full(a1)<>A) then pause,end
  375. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  376. if or(full(a1)<>A) then pause,end
  377. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  378. if or(full(a1)<>A) then pause,end
  379. a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
  380. if or(full(a1)<>A) then pause,end
  381. a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
  382. if or(full(a1)<>A) then pause,end
  383. a1=a;a1([1 3],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([1 3],:)=[Vt;2*Vt];
  384. if or(full(a1)<>A) then pause,end
  385. a1=a;a1([3 1],:)=[vt;2*vt];A=full(a);Vt=full(vt);A([3 1],:)=[Vt;2*Vt];
  386. if or(full(a1)<>A) then pause,end
  387. a1=a;a1([1 3 1],:)=[vt;2*vt;3*vt];A=full(a);Vt=full(vt);A([1 3 1],:)=[Vt;2*Vt;3*Vt];
  388. if or(full(a1)<>A) then pause,end
  389. a=sparse([],[],[6,6]);
  390. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  391. if or(full(a1)<>A) then pause,end
  392. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  393. if or(full(a1)<>A) then pause,end
  394. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  395. if or(full(a1)<>A) then pause,end
  396. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  397. if or(full(a1)<>A) then pause,end
  398. a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
  399. if or(full(a1)<>A) then pause,end
  400. a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
  401. if or(full(a1)<>A) then pause,end
  402. b=sparse([1 1;1 3;1 6;2 1;2 2;2 4],10:15,[2,6]);
  403. a1=a;a1([1 3],:)=b;A=full(a);B=full(b);A([1 3],:)=B;
  404. if or(full(a1)<>A) then pause,end
  405. a1=a;a1([3 1],:)=b;A=full(a);B=full(b);A([3 1],:)=B;
  406. if or(full(a1)<>A) then pause,end
  407. b=sparse([1 1;1 3;1 6;2 1;2 2;2 4;3 3;3 5],10:17,[3,6]);
  408. a1=a;a1([1 3 1],:)=b;A=full(a);B=full(b);A([1 3 1],:)=B;
  409. if or(full(a1)<>A) then pause,end
  410. //  insert zero vector
  411. vt=sparse([],[],[1,6]);
  412. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  413. if or(full(a1)<>A) then pause,end
  414. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  415. if or(full(a1)<>A) then pause,end
  416. a1=a;a1(1,:)=vt;A=full(a);Vt=full(vt);A(1,:)=Vt;
  417. if or(full(a1)<>A) then pause,end
  418. a1=a;a1(3,:)=vt;A=full(a);Vt=full(vt);A(3,:)=Vt;
  419. if or(full(a1)<>A) then pause,end
  420. a1=a;a1(7,:)=vt;A=full(a);Vt=full(vt);A(7,:)=Vt;
  421. if or(full(a1)<>A) then pause,end
  422. a1=a;a1(8,:)=vt;A=full(a);Vt=full(vt);A(8,:)=Vt;
  423. if or(full(a1)<>A) then pause,end
  424. b=sparse([1 1;1 3;1 6;2 1;2 2;2 4],10:15,[2,6]);
  425. a1=a;a1([1 3],:)=b;A=full(a);B=full(b);A([1 3],:)=B;
  426. if or(full(a1)<>A) then pause,end
  427. a1=a;a1([3 1],:)=b;A=full(a);B=full(b);A([3 1],:)=B;
  428. if or(full(a1)<>A) then pause,end
  429. b=sparse([1 1;1 3;1 6;2 1;2 2;2 4;3 3;3 5],10:17,[3,6]);
  430. a1=a;a1([1 3 1],:)=b;A=full(a);B=full(b);A([1 3 1],:)=B;
  431. if or(full(a1)<>A) then pause,end
  432. // full column insertion
  433. //----------------------
  434. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  435. v=sparse([2 1;3 1;4 1;6 1],[10;11;12;13],[6,1]);
  436. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  437. if or(full(a1)<>A) then pause,end
  438. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  439. if or(full(a1)<>A) then pause,end
  440. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  441. if or(full(a1)<>A) then pause,end
  442. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  443. if or(full(a1)<>A) then pause,end
  444. a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
  445. if or(full(a1)<>A) then pause,end
  446. //
  447. a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
  448. if or(full(a1)<>A) then pause,end
  449. a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
  450. if or(full(a1)<>A) then pause,end
  451. b=sparse([1 2;2 1;3 1;3 2;4 1;6 2],10:15,[6,2]);
  452. a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
  453. if or(full(a1)<>A) then pause,end
  454. a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
  455. if or(full(a1)<>A) then pause,end
  456. b=sparse([1 2;2 1;2 3;3 1;3 2;4 1;5 3;6 2],10:17,[6,3]);
  457. a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
  458. if or(full(a1)<>A) then pause,end
  459. v=sparse([],[],[6,1]);
  460. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  461. if or(full(a1)<>A) then pause,end
  462. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  463. if or(full(a1)<>A) then pause,end
  464. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  465. if or(full(a1)<>A) then pause,end
  466. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  467. if or(full(a1)<>A) then pause,end
  468. a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
  469. if or(full(a1)<>A) then pause,end
  470. //
  471. a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
  472. if or(full(a1)<>A) then pause,end
  473. a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
  474. if or(full(a1)<>A) then pause,end
  475. b=sparse([],[],[6,2]);
  476. a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
  477. if or(full(a1)<>A) then pause,end
  478. a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
  479. if or(full(a1)<>A) then pause,end
  480. b=sparse([],[],[6,3]);
  481. a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
  482. if or(full(a1)<>A) then pause,end
  483. a=sparse([],[],[6,6]);
  484. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  485. if or(full(a1)<>A) then pause,end
  486. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  487. if or(full(a1)<>A) then pause,end
  488. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  489. if or(full(a1)<>A) then pause,end
  490. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  491. if or(full(a1)<>A) then pause,end
  492. a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
  493. if or(full(a1)<>A) then pause,end
  494. //
  495. a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
  496. if or(full(a1)<>A) then pause,end
  497. a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
  498. if or(full(a1)<>A) then pause,end
  499. b=sparse([1 2;2 1;3 1;3 2;4 1;6 2],10:15,[6,2]);
  500. a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
  501. if or(full(a1)<>A) then pause,end
  502. a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
  503. if or(full(a1)<>A) then pause,end
  504. b=sparse([1 2;2 1;2 3;3 1;3 2;4 1;5 3;6 2],10:17,[6,3]);
  505. a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
  506. if or(full(a1)<>A) then pause,end
  507. v=sparse([],[],[6,1]);
  508. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  509. if or(full(a1)<>A) then pause,end
  510. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  511. if or(full(a1)<>A) then pause,end
  512. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  513. if or(full(a1)<>A) then pause,end
  514. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  515. if or(full(a1)<>A) then pause,end
  516. a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
  517. if or(full(a1)<>A) then pause,end
  518. //
  519. a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
  520. if or(full(a1)<>A) then pause,end
  521. a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
  522. if or(full(a1)<>A) then pause,end
  523. b=sparse([1 2;2 1;3 1;3 2;4 1;6 2],10:15,[6,2]);
  524. a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
  525. if or(full(a1)<>A) then pause,end
  526. a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
  527. if or(full(a1)<>A) then pause,end
  528. b=sparse([1 2;2 1;2 3;3 1;3 2;4 1;5 3;6 2],10:17,[6,3]);
  529. a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
  530. if or(full(a1)<>A) then pause,end
  531. v=sparse([],[],[6,1]);
  532. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  533. if or(full(a1)<>A) then pause,end
  534. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  535. if or(full(a1)<>A) then pause,end
  536. a1=a;a1(:,1)=v;A=full(a);V=full(v);A(:,1)=V;
  537. if or(full(a1)<>A) then pause,end
  538. a1=a;a1(:,2)=v;A=full(a);V=full(v);A(:,2)=V;
  539. if or(full(a1)<>A) then pause,end
  540. a1=a;a1(:,3)=v;A=full(a);V=full(v);A(:,3)=V;
  541. if or(full(a1)<>A) then pause,end
  542. //
  543. a1=a;a1(:,7)=v;A=full(a);V=full(v);A(:,7)=V;
  544. if or(full(a1)<>A) then pause,end
  545. a1=a;a1(:,8)=v;A=full(a);V=full(v);A(:,8)=V;
  546. if or(full(a1)<>A) then pause,end
  547. b=sparse([],[],[6,2]);
  548. a1=a;a1(:,[1 3])=b;A=full(a);B=full(b);A(:,[1 3])=B;
  549. if or(full(a1)<>A) then pause,end
  550. a1=a;a1(:,[3 1])=b;A=full(a);B=full(b);A(:,[3 1])=B;
  551. if or(full(a1)<>A) then pause,end
  552. b=sparse([],[],[6,3]);
  553. a1=a;a1(:,[1 3 1])=b;A=full(a);B=full(b);A(:,[1 3 1])=B;
  554. if or(full(a1)<>A) then pause,end
  555. // row column insertion
  556. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  557. b=sparse([1 2;1 3;3 3],-(1:3),[3,3]);
  558. a1=a;a1(1,1)=sparse(30);A=full(a);A(1,1)=30;
  559. if or(full(a1)<>A) then pause,end
  560. a1=a;a1(1,6)=sparse(30);A=full(a);A(1,6)=30;
  561. if or(full(a1)<>A) then pause,end
  562. a1=a;a1(1,8)=sparse(30);A=full(a);A(1,8)=30;
  563. if or(full(a1)<>A) then pause,end
  564. a1=a;a1(1:3,1:3)=b;A=full(a);A(1:3,1:3)=full(b);
  565. if or(full(a1)<>A) then pause,end
  566. a1=a;a1(1:3,6:8)=b;A=full(a);A(1:3,6:8)=full(b);
  567. if or(full(a1)<>A) then pause,end
  568. a1=a;a1(6:8,1:3)=b;A=full(a);A(6:8,1:3)=full(b);
  569. if or(full(a1)<>A) then pause,end
  570. a1=a;a1([3 2 1],1:3)=b;A=full(a);A([3 2 1],1:3)=full(b);
  571. if or(full(a1)<>A) then pause,end
  572. a1=a;a1([1 2 1],1:3)=b;A=full(a);A([1 2 1],1:3)=full(b);
  573. if or(full(a1)<>A) then pause,end
  574. a1=a;a1([3 2 1],[3 2 1])=b;A=full(a);A([3 2 1],[3 2 1])=full(b);
  575. if or(full(a1)<>A) then pause,end
  576. a1=a;a1([1 2 1],[3 2 1])=b;A=full(a);A([1 2 1],[3 2 1])=full(b);
  577. if or(full(a1)<>A) then pause,end
  578. a1=a;a1([1 2 1],[1 2 1])=b;A=full(a);A([1 2 1],[1 2 1])=full(b);
  579. if or(full(a1)<>A) then pause,end
  580. //sparse full
  581. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  582. vt=11:16;
  583. // full line insertion
  584. //----------------------
  585. a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
  586. if or(full(a1)<>A) then pause,end
  587. a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
  588. if or(full(a1)<>A) then pause,end
  589. a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
  590. if or(full(a1)<>A) then pause,end
  591. a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
  592. if or(full(a1)<>A) then pause,end
  593. a1=a;a1(7,:)=vt;A=full(a);A(7,:)=vt;
  594. if or(full(a1)<>A) then pause,end
  595. a1=a;a1(8,:)=vt;A=full(a);A(8,:)=vt;
  596. if or(full(a1)<>A) then pause,end
  597. a1=a;a1([1 3],:)=[vt;2*vt];A=full(a);A([1 3],:)=[vt;2*vt];
  598. if or(full(a1)<>A) then pause,end
  599. a1=a;a1([3 1],:)=[vt;2*vt];A=full(a);A([3 1],:)=[vt;2*vt];
  600. if or(full(a1)<>A) then pause,end
  601. a1=a;a1([1 3 1],:)=[vt;2*vt;3*vt];A=full(a);A([1 3 1],:)=[vt;2*vt;3*vt];
  602. if or(full(a1)<>A) then pause,end
  603. a=sparse([],[],[6,6]);
  604. a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
  605. if or(full(a1)<>A) then pause,end
  606. a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
  607. if or(full(a1)<>A) then pause,end
  608. a1=a;a1(1,:)=vt;A=full(a);A(1,:)=vt;
  609. if or(full(a1)<>A) then pause,end
  610. a1=a;a1(3,:)=vt;A=full(a);A(3,:)=vt;
  611. if or(full(a1)<>A) then pause,end
  612. a1=a;a1(7,:)=vt;A=full(a);A(7,:)=vt;
  613. if or(full(a1)<>A) then pause,end
  614. a1=a;a1(8,:)=vt;A=full(a);A(8,:)=vt;
  615. if or(full(a1)<>A) then pause,end
  616. b=[1:6;11:16];
  617. a1=a;a1([1 3],:)=b;A=full(a);A([1 3],:)=b;
  618. if or(full(a1)<>A) then pause,end
  619. a1=a;a1([3 1],:)=b;A=full(a);A([3 1],:)=b;
  620. if or(full(a1)<>A) then pause,end
  621. b=[1:6;11:16;21:26];
  622. a1=a;a1([1 3 1],:)=b;A=full(a);A([1 3 1],:)=b;
  623. if or(full(a1)<>A) then pause,end
  624. // full column insertion
  625. //----------------------
  626. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  627. v=(1:6)';
  628. a1=a;a1(:,1)=v;A=full(a);A(:,1)=v;
  629. if or(full(a1)<>A) then pause,end
  630. a1=a;a1(:,2)=v;A=full(a);A(:,2)=v;
  631. if or(full(a1)<>A) then pause,end
  632. a1=a;a1(:,1)=v;A=full(a);A(:,1)=v;
  633. if or(full(a1)<>A) then pause,end
  634. a1=a;a1(:,2)=v;A=full(a);A(:,2)=v;
  635. if or(full(a1)<>A) then pause,end
  636. a1=a;a1(:,3)=v;A=full(a);A(:,3)=v;
  637. if or(full(a1)<>A) then pause,end
  638. //
  639. a1=a;a1(:,7)=v;A=full(a);A(:,7)=v;
  640. if or(full(a1)<>A) then pause,end
  641. a1=a;a1(:,8)=v;A=full(a);A(:,8)=v;
  642. if or(full(a1)<>A) then pause,end
  643. b=[(1:6)' (11:16)'];
  644. a1=a;a1(:,[1 3])=b;A=full(a);A(:,[1 3])=b;
  645. if or(full(a1)<>A) then pause,end
  646. a1=a;a1(:,[3 1])=b;A=full(a);A(:,[3 1])=b;
  647. if or(full(a1)<>A) then pause,end
  648. b=[(1:6)' (11:16)' (21:26)'];
  649. a1=a;a1(:,[1 3 1])=b;A=full(a);A(:,[1 3 1])=b;
  650. if or(full(a1)<>A) then pause,end
  651. //********
  652. // row column insertion
  653. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  654. b=-[1 2 3;4 5 6;7 8 9];
  655. a1=a;a1(1,1)=30;A=full(a);A(1,1)=30;
  656. if or(full(a1)<>A) then pause,end
  657. a1=a;a1(1,6)=30;A=full(a);A(1,6)=30;
  658. if or(full(a1)<>A) then pause,end
  659. a1=a;a1(1,8)=30;A=full(a);A(1,8)=30;
  660. if or(full(a1)<>A) then pause,end
  661. a1=a;a1(1:3,1:3)=b;A=full(a);A(1:3,1:3)=b;
  662. if or(full(a1)<>A) then pause,end
  663. a1=a;a1(1:3,6:8)=b;A=full(a);A(1:3,6:8)=b;
  664. if or(full(a1)<>A) then pause,end
  665. a1=a;a1(6:8,1:3)=b;A=full(a);A(6:8,1:3)=b;
  666. if or(full(a1)<>A) then pause,end
  667. a1=a;a1([3 2 1],1:3)=b;A=full(a);A([3 2 1],1:3)=b;
  668. if or(full(a1)<>A) then pause,end
  669. a1=a;a1([1 2 1],1:3)=b;A=full(a);A([1 2 1],1:3)=b;
  670. if or(full(a1)<>A) then pause,end
  671. a1=a;a1([3 2 1],[3 2 1])=b;A=full(a);A([3 2 1],[3 2 1])=b;
  672. if or(full(a1)<>A) then pause,end
  673. a1=a;a1([1 2 1],[3 2 1])=b;A=full(a);A([1 2 1],[3 2 1])=b;
  674. if or(full(a1)<>A) then pause,end
  675. a1=a;a1([1 2 1],[1 2 1])=b;A=full(a);A([1 2 1],[1 2 1])=b;
  676. if or(full(a1)<>A) then pause,end
  677. // vector insertion
  678. v=sparse([1 1;3 1;6 1],[10 11 12],[6 1]);
  679. v1=v;v1(1)=33;V=full(v);V(1)=33;
  680. if or(full(v1)<>V) then pause,end
  681. v1=v;v1(2)=33;V=full(v);V(2)=33;
  682. if or(full(v1)<>V) then pause,end
  683. v1=v;v1(8)=33;V=full(v);V(8)=33;
  684. if or(full(v1)<>V) then pause,end
  685. v1=v;v1([1 2 8])=[5;10;33];V=full(v);V([1 2 8])=[5;10;33];
  686. if or(full(v1)<>V) then pause,end
  687. v1=v;v1(:)=[];
  688. if or(full(v1)<>[]) then pause,end
  689. v1=v;v1(1)=sparse(33);V=full(v);V(1)=33;
  690. if or(full(v1)<>V) then pause,end
  691. v1=v;v1(2)=sparse(33);V=full(v);V(2)=33;
  692. if or(full(v1)<>V) then pause,end
  693. v1=v;v1(8)=sparse(33);V=full(v);V(8)=33;
  694. if or(full(v1)<>V) then pause,end
  695. v1=v;v1([1 2 8])=sparse([5;10;33]);V=full(v);V([1 2 8])=[5;10;33];
  696. if or(full(v1)<>V) then pause,end
  697. v1=v;v1([1 2 1])=sparse([5;10;33]);V=full(v);V([1 2 1])=[5;10;33];
  698. if or(full(v1)<>V) then pause,end
  699. v1=v;v1(:)=[];
  700. if or(full(v1)<>[]) then pause,end
  701. v1=v;v1(:)=sparse([2 1],44,[6 1]);V=full(v);V(:)=[0;44;0;0;0;0];
  702. if or(full(v1)<>V) then pause,end
  703. v=v';
  704. v1=v;v1(1)=33;V=full(v);V(1)=33;
  705. if or(full(v1)<>V) then pause,end
  706. v1=v;v1(2)=33;V=full(v);V(2)=33;
  707. if or(full(v1)<>V) then pause,end
  708. v1=v;v1(8)=33;V=full(v);V(8)=33;
  709. if or(full(v1)<>V) then pause,end
  710. v1=v;v1([1 2 8])=[5 10 33];V=full(v);V([1 2 8])=[5 10 33];
  711. if or(full(v1)<>V) then pause,end
  712. v1=v;v1(1)=sparse(33);V=full(v);V(1)=33;
  713. if or(full(v1)<>V) then pause,end
  714. v1=v;v1(2)=sparse(33);V=full(v);V(2)=33;
  715. if or(full(v1)<>V) then pause,end
  716. v1=v;v1(8)=sparse(33);V=full(v);V(8)=33;
  717. if or(full(v1)<>V) then pause,end
  718. v1=v;v1([1 2 8])=sparse([5 10 33]);V=full(v);V([1 2 8])=[5 10 33];
  719. if or(full(v1)<>V) then pause,end
  720. v1=v;v1([1 2 1])=sparse([5 10 33]);V=full(v);V([1 2 1])=[5 10 33];
  721. if or(full(v1)<>V) then pause,end
  722. v1=v;v1(:)=sparse([1 2],44,[1,6]);V=full(v);V(:)=[0 44 0 0 0 0];
  723. if or(full(v1)<>V) then pause,end
  724. v1=v;v1(1)=[];V=full(v);V(1)=[];
  725. if or(full(v1)<>V) then pause,end
  726. //test des comparaisons
  727. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  728. b=sparse([1 6;1 2;6 5],[10;-1;-1],[6 6]);
  729. if full(a==a)<>full(a)==full(a) then pause,end
  730. if full(a<>a)<>(full(a)<>full(a)) then pause,end
  731. if full(a>sparse(5))<>(full(a)>5) then pause,end
  732. if full(sparse(5)>a)<>(5>full(a)) then pause,end
  733. if full(b>a)<>(full(b)>full(a))  then pause,end
  734. if full(a==full(a))<>full(a)==full(a) then pause,end
  735. if full(a<>full(a))<>(full(a)<>full(a)) then pause,end
  736. if full(a>5)<>(full(a)>5) then pause,end
  737. if full(5>a)<>(5>full(a)) then pause,end
  738. if full(b>full(a))<>(full(b)>full(a))  then pause,end
  739. if full(full(a)==a)<>full(a)==full(a) then pause,end
  740. if full(full(a)<>a)<>(full(a)<>full(a)) then pause,end
  741. if full(full(a)>sparse(5))<>(full(a)>5) then pause,end
  742. if full(full(b)>a)<>(full(b)>full(a))  then pause,end
  743. a=sparse([1 1;3 1;6 1],[10 11 12],[6 1]);
  744. if full(a==a)<>full(a)==full(a) then pause,end
  745. if full(a<>a)<>(full(a)<>full(a)) then pause,end
  746. if full(a>sparse(5))<>(full(a)>5) then pause,end
  747. if full(sparse(5)>a)<>(5>full(a)) then pause,end
  748. if full(a==full(a))<>full(a)==full(a) then pause,end
  749. if full(a<>full(a))<>(full(a)<>full(a)) then pause,end
  750. if full(a>5)<>(full(a)>5) then pause,end
  751. if full(5>a)<>(5>full(a)) then pause,end
  752. if full(full(a)==a)<>full(a)==full(a) then pause,end
  753. if full(full(a)<>a)<>(full(a)<>full(a)) then pause,end
  754. if full(full(a)>sparse(5))<>(full(a)>5) then pause,end
  755. a=a';
  756. if full(a==a)<>full(a)==full(a) then pause,end
  757. if full(a<>a)<>(full(a)<>full(a)) then pause,end
  758. if full(a>sparse(5))<>(full(a)>5) then pause,end
  759. if full(sparse(5)>a)<>(5>full(a)) then pause,end
  760. if full(a==full(a))<>full(a)==full(a) then pause,end
  761. if full(a<>full(a))<>(full(a)<>full(a)) then pause,end
  762. if full(a>5)<>(full(a)>5) then pause,end
  763. if full(5>a)<>(5>full(a)) then pause,end
  764. if full(full(a)==a)<>full(a)==full(a) then pause,end
  765. if full(full(a)<>a)<>(full(a)<>full(a)) then pause,end
  766. if full(full(a)>sparse(5))<>(full(a)>5) then pause,end
  767. a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
  768. b=sparse([1 6;1 2;5 5],[10;-1;-1],[5 6]);
  769. if a==b<>%f then pause,end
  770. if a<>b<>%t then pause,end
  771.